package com.t5.services;

import com.t5.bo.Account;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestServiceImpl implements TestService {

  @Autowired
  private SessionFactory sessionFactory;


  @Override
  public List<Account> getAllAccount() {
    Session session = sessionFactory.openSession();

    final Query query = session.createQuery("FROM Account");
    List list = query.list();

    session.close();
    return list;
  }
}
